home *** CD-ROM | disk | FTP | other *** search
/ Night Owl 9 / Night Owl CD-ROM (NOPV9) (Night Owl Publisher) (1993).ISO / 005a / pbank21b.zip / AWARD.PPS < prev    next >
Text File  |  1993-06-16  |  4KB  |  84 lines

  1. ;*****************************************************************************
  2. ;*                                                                           *
  3. ;*                          AWARD BANK V1.0                                  *
  4. ;*                                                                           *
  5. ;*                 using PCBoard Programming Language [PPL]                  *
  6. ;*                     to work with PPL Time Bank                            *
  7. ;*                                                                           *
  8. ;*                       Written by: Peter Veeck                             *
  9. ;*                                                                           *
  10. ;*                      posted on Saltair: 06-15-93                          *
  11. ;*                                                                           *
  12. ;*                                                                           *
  13. ;*                Modification History:  See History.doc file                *
  14. ;*                                                                           *
  15. ;*****************************************************************************
  16. ;
  17. ; Cmd line:  award nnn [nn]
  18. ;
  19. :DEFINE_VARIABLES
  20.   INTEGER chgtime,found,opts,note_line
  21.   STRING disp_file,count,junk,disp_award
  22.   STRING usertoken(10)
  23. :SET_PARAMETERS
  24.   note_line        = 4    ; Line to use for storage in NOTES PSA
  25.                           ; will be overridden if environment variable
  26. :START                    ; PBANK is set.
  27.   GETTOKEN chgtime
  28.   disp_award = "award" + gettoken()
  29.   IF (GETENV("PBANK")) DO          ; Check for environment variable
  30.      TOKENIZE GETENV("PBANK")      ;
  31.      GETTOKEN junk
  32.      GETTOKEN junk
  33.      GETTOKEN junk
  34.      GETTOKEN junk
  35.      GETTOKEN note_line            ;
  36.   ENDIF                            ; of the variables listed here.
  37.   IF (!(PSA(6))) DO                                  ;
  38.     LOG "You must have the NOTES PSA installed for Awards.",0
  39.     goto EXIT
  40.   ENDIF
  41.   GETUSER
  42.   IF ((U_NOTES(note_line)) = ("")) DO
  43.     opts = 0
  44.     GOTO NEWBANK
  45.   ELSE
  46.     found = 0
  47.     TOKENIZE U_NOTES(note_line)         ; Split up NOTES line
  48.     opts = TOKCOUNT()
  49.     IF (opts > 10) DO                   ; too many tokens for array?
  50.       LOG "Too many tokens on NOTES line to use Award",0
  51.       GOTO EXIT
  52.     ENDIF
  53.     FOR count = 1 TO opts               ; Get bank info from notes line
  54.       GETTOKEN usertoken(count)         ;
  55.       if (usertoken(count) == "BANK") found = count
  56.     ENDFOR
  57.     if (found > 0) goto POST
  58.   ENDIF
  59. :NEWBANK
  60.   IF (opts > 7) DO                      ; too many tokens for array?
  61.     LOG "Too many tokens on NOTES line for Award.",0
  62.     GOTO EXIT
  63.   ENDIF
  64.   IF (!(INSTR(U_NOTES(note_line),"               "))) DO  ; room to store bank?
  65.     LOG "Not enough room on NOTES line to set up new bank.",0
  66.     GOTO EXIT
  67.   ENDIF
  68.   found = opts + 1
  69.   opts = opts + 3
  70.   usertoken(found) = "BANK"
  71.   usertoken(found+1) = "TIME"
  72.   usertoken(found+2) = 0
  73. :POST
  74.   usertoken(found+2) = usertoken(found+2) + chgtime
  75.   U_NOTES(note_line) = usertoken(1)              ; Put U_NOTES back
  76.   FOR count = 2 TO (opts)                        ;   together
  77.     U_NOTES(note_line) = U_NOTES(note_line)+" "+usertoken(count)  ;
  78.   ENDFOR
  79.   PUTUSER                            ; update bank
  80.   LOG "Awarded: "+ STRING(chgtime) +"min.      Total Bank time: "+STRING(usertoken(found+2))+" min.",0
  81.   IF (EXIST(PPEPATH() + disp_award)) DISPFILE PPEPATH() + disp_award,LANG+GRAPH
  82. :EXIT
  83.   END
  84.